package cn.liulin.spring_boot_study.pojo;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * cn.liulin.spring_boot_study.pojo$
 *
 * @author ll
 * @date 2021-10-22 14:16:37
 **/
//@Component
public class BeanPostProcessorExample implements BeanPostProcessor {
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("BeanPostProcessor调用postProcessBeforeInitialization方法，参数【" +
                bean.getClass().getSimpleName() + "】【" + beanName + "】");
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("BeanPostProcessor调用postProcessAfterInitialization方法，参数【" +
                bean.getClass().getSimpleName() + "】【" + beanName + "】");
        return bean;
    }
}
